<template>
  <div class="error-container">
    <div class="error-content">
      <div class="error-code">404</div>
      <div class="error-message">页面不存在</div>
      <p class="error-description">
        抱歉，您访问的页面不存在或已被删除。
        请检查您输入的网址是否正确，或尝试以下操作：
      </p>
      <div class="error-actions">
        <router-link to="/" class="btn-home">返回首页</router-link>
        <button class="btn-back" @click="goBack">返回上一页</button>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const searchQuery = ref('')

// 返回上一页
const goBack = () => {
  if (window.history.length > 1) {
    window.history.back()
  } else {
    router.push('/')
  }
}
</script>

<style scoped>
.error-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 20px;
}

.error-content {
  text-align: center;
  max-width: 600px;
  width: 100%;
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.error-content:hover {
  transform: translateY(-5px);
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  color: #4a6fa5;
  margin-bottom: 20px;
  background: linear-gradient(45deg, #4a6fa5, #6b8e23);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.error-code::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: #4a6fa5;
  border-radius: 2px;
}

.error-message {
  font-size: 32px;
  font-weight: 600;
  color: #333;
  margin-bottom: 20px;
}

.error-description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 40px;
}

.error-actions {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-bottom: 30px;
}

.btn-home,
.btn-back,
.btn-search {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  outline: none;
  text-decoration: none;
}

.btn-home {
  background: #4a6fa5;
  color: white;
}

.btn-home:hover {
  background: #3a5a8a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 111, 165, 0.3);
}

.btn-back {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
}

.btn-back:hover {
  background: #e0e0e0;
  transform: translateY(-2px);
}

.search-box {
  display: flex;
  gap: 10px;
  justify-content: center;
  max-width: 400px;
  margin: 0 auto;
}

.search-box input {
  flex: 1;
  padding: 12px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 30px;
  font-size: 16px;
  transition: border-color 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: #4a6fa5;
}

.btn-search {
  background: #6b8e23;
  color: white;
  padding: 12px 24px;
}

.btn-search:hover {
  background: #5a7e13;
  transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .error-content {
    padding: 40px 20px;
  }

  .error-code {
    font-size: 80px;
  }

  .error-message {
    font-size: 24px;
  }

  .error-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-home,
  .btn-back {
    width: 100%;
    max-width: 200px;
  }

  .search-box {
    flex-direction: column;
    align-items: center;
  }

  .search-box input,
  .btn-search {
    width: 100%;
    max-width: 300px;
  }
}
</style>
